package util;

import java.util.concurrent.ThreadLocalRandom;

public class StringUtil {
	private static final ThreadLocalRandom RANDOM = ThreadLocalRandom.current();


	/**
	 * 检测是否为null，是否为'null'字符串，去除空格后是否为空串
	 */
	public static boolean isEmpty(String s) {
		return s == null || "null".equals(s) || "".equals(s.trim());
	}

	/**
	 * 生成随机的五位数字验证码
	 */
	public static String createDigitalCode() {
		StringBuilder code = new StringBuilder();
		for (int i = 0; i < 5; i++) code.append(RANDOM.nextInt(10));
		return code.toString();
	}
}
